#include "app_buffer.h"
#include <stdio.h>

int main(int argc, char const *argv[])
{
    // 1.创建缓冲区
    app_buffer_t *buffer = app_buffer_init();
    // 2.写入数据
    app_buffer_write(buffer, "hello", 5);
    app_buffer_write(buffer, "world", 5);

    // 3.读取数据
    char tmp_buff[100];
    int read_size = app_buffer_read(buffer, tmp_buff, 100);
    printf(" read text = %.*s\n", read_size, tmp_buff);
    read_size = app_buffer_read(buffer, tmp_buff, 100);
    printf(" read text = %.*s\n", read_size, tmp_buff);

    app_buffer_destroy(buffer);
    return 0;
}
